package sc.analysis.ppo;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.Writable;

/**
 * Used to store data between the mapper and the reducer of PPO analysis.
 * 
 * @author Quentin Rossé
 *
 */
public class PpoData implements Writable{
	
	private float ppo;
	
	private float prevPpo;
	
	private float histogram;
	
	private float prevHistogram;
	
	
	public PpoData(float ppo, 
			       float prevPpo, 
			       float histogram,
			       float prevHistogram) {
		this.ppo = ppo;
		this.prevPpo = prevPpo;
		this.histogram = histogram;
		this.prevHistogram = prevHistogram;
	}
	
	
	public void setAll(float ppo, 
		               float prevPpo, 
		               float histogram,
		               float prevHistogram) {
		this.ppo = ppo;
		this.prevPpo = prevPpo;
		this.histogram = histogram;
		this.prevHistogram = prevHistogram;
	}

	public float getPpo() {
		return ppo;
	}


	public float getPrevPpo() {
		return prevPpo;
	}


	public float getHistogram() {
		return histogram;
	}


	public float getPrevHistogram() {
		return prevHistogram;
	}


	public PpoData(){}
	

	@Override
	public void readFields(DataInput in) throws IOException {
		ppo = in.readFloat();
		prevPpo = in.readFloat();
		histogram = in.readFloat();
		prevHistogram = in.readFloat();
	}

	@Override
	public void write(DataOutput out) throws IOException {
		out.writeFloat(ppo);
		out.writeFloat(prevPpo);
		out.writeFloat(histogram);
		out.writeFloat(prevHistogram);
	}

}
